#!/bin/bash

PROXY_URL="http://10.223.96.54:10808"

function enable_proxy() {
    export http_proxy=$PROXY_URL
    export https_proxy=$PROXY_URL
    echo "代理已开启: $PROXY_URL"
}

function disable_proxy() {
    unset http_proxy
    unset https_proxy
    echo "代理已关闭"
}

case "$1" in
    "on")
        enable_proxy
        ;;
    "off")
        disable_proxy
        ;;
    *)
        echo "使用方法: $0 [on|off]"
        echo "  on   - 开启代理"
        echo "  off  - 关闭代理"
        exit 1
        ;;
esac